import BuffUtil from '@/BuffUtil';
import UnitSpellEvent from '@/event/UnitSpellEvent';
import BaseUtil from '@/BaseUtil';
import UnitItemEvent from '@/event/UnitItemEvent';
import ArrayUtil from '@/ArrayUtil';
import SelectCommon from 'code/Core/Common/SelectCommon';
export default class Item_弗拉迪米尔的祭品 {
    static id = 'clfm';
    static 名称: string = '弗拉迪米尔的祭品';
    static 描述: string = '你的攻击力、攻击吸血、法术吸血、法力回复及护甲提高了';
    static 图标: string = 'ReplaceableTextures\\CommandButtons\\BTNCloakOfFlames.blp';
    static buffId: string = 'buff_item_jipin';
    static buffType: AppBuffType = {
        id: 'buff_item_jipin',
        name: Item_弗拉迪米尔的祭品.名称,
        ubertip: Item_弗拉迪米尔的祭品.描述,
        art: Item_弗拉迪米尔的祭品.图标,
        attribute: {
            attack_p: 0.15,
            法力恢复: 1.5,
            法术吸血: 0.05,
            物理吸血: 0.05,
            附加护甲: 10,
        },
        targetArt: 'Abilities\\Spells\\Other\\GeneralAuraTarget\\GeneralAuraTarget.mdl',
        targetAttach: 'foot',
        class: '光环',
        dur: 2,
    };
    static 添加技能(目标: unit) {
        UnitAddAbility(目标, Item_弗拉迪米尔的祭品.id);
    }
    static 释放(x: number, y: number, 来源?: unit, 目标?: unit, d?: any) {}
    static 光环提供者数组: unit[] = [];
    constructor() {
        BuffUtil.registerBuffType(Item_弗拉迪米尔的祭品.buffType);
        se.onUnitPickupItem(Item_弗拉迪米尔的祭品.获取物品);
        se.onUnitDropItem(Item_弗拉迪米尔的祭品.失去物品);
        se.onUnitPawnItem(Item_弗拉迪米尔的祭品.失去物品);
        se.onUnitSellItem(Item_弗拉迪米尔的祭品.失去物品);
        BaseUtil.onTimer(0.5, Item_弗拉迪米尔的祭品.计时器函数);
    }
    static 计时器函数() {
        for (let p of Item_弗拉迪米尔的祭品.光环提供者数组) {
            let us = SelectCommon.getAllyUnitInRange(p, 900);
            for (let u of us) {
                BuffUtil.addBuff(u, Item_弗拉迪米尔的祭品.buffId, p);
            }
        }
        return true;
    }
    static 失去物品(d: UnitItemEvent) {
        let it = GetManipulatedItem();
        if (GetItemTypeId(it) != FourCC(Item_弗拉迪米尔的祭品.id)) return;
        ArrayUtil.removeElement(Item_弗拉迪米尔的祭品.光环提供者数组, GetTriggerUnit());
    }
    static 获取物品(d: UnitItemEvent) {
        let it = GetManipulatedItem();
        if (GetItemTypeId(it) != FourCC(Item_弗拉迪米尔的祭品.id)) return;
        Item_弗拉迪米尔的祭品.光环提供者数组.push(GetTriggerUnit());
    }
    static spellEffect(this: void, d: UnitSpellEvent) {}
}
